<?php
	$DefSelect = '------------------------ Todos ------------------------'; 
	//==========================Vars===========================
	$cb_Banco = 0;
	$Currency = 2;

	$Origen0 = null;
	$Status = 2;

	$OrderAD1 = 'ASC'; 
	$OrderAD2 = 'ASC'; 
	$OrderAD3 = 'ASC';

	$OrderBy1 = null; 
	$OrderBy2 = null; 
	$OrderBy3 = null;

	if(isset($_POST['cb_Banco']) && $_POST['cb_Banco'] != '') {
	$cb_Banco = $_POST['cb_Banco'];
	}

	if(isset($_POST['ExcOrigen0']) && $_POST['ExcOrigen0'] != '') {
	$Origen1 = $_POST['ExcOrigen0'];
	}
	if(isset($_POST['FraCorresponsal']) && $_POST['FraCorresponsal'] != '') {
	$Origen2 = $_POST['FraCorresponsal'];
	}
	if(isset($_POST['FraStatus']) && $_POST['FraStatus'] != '') {
	$Status = $_POST['FraStatus'];
	}	

	form_pr('ExchQuery','','','post'); ?>
<table width="100%"  border="0" cellpadding="3" cellspacing="1">
        <tr bgcolor="#F2F2F2">
          <td rowspan="2" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>Periodo:
			  </td>
              <td><?php echo 'De: ';
		mn_field('date','ED','TStart',date("Y-m-d"),'ExchQuery','8','','');
		echo ' At&eacute;: ';
		mn_field('date','ED','TEnd',date("Y-m-d"),'ExchQuery','8','','');
		echo ' | ';
		mn_field('hselect','ED','IsAlbaran','1','Todas;Apenas Encaminhadas;Nao Encaminhadas#;1;0','','','" checked class="'); ?></td>
            </tr>
            <tr>
              <td>Moeda:</td>
              <td><?php
		$Qur = "SELECT miso_Cod_elite AS ID, miso_ID AS NAME FROM hd_monedasiso WHERE miso_Cod_elite > 0";
		  mn_field('select','ED','Currency',$Currency,$Qur,$DefSelect,'False','" style="width:370px'); ?></td>
            </tr>
            <tr>
              <td>Dominio:</td>
              <td><?php
		$Qur = "SELECT dom_ID AS ID, CONCAT(dom_ID,' ',dom_RazonSocial) AS NAME 
		  		FROM dominios WHERE dom_Activo = 1";
		  mn_field('select','ED','ExcOrigen0',$Origen0,$Qur,$DefSelect,'False','" style="width:370px" onchange="
		  document.ExchQuery.action=\'_response/call.php?get=Exchange/lib/filt_050101.php\';
		  subform(\'ExchQuery\',\'filt_050101\');'); ?></td>
            </tr>
            <tr>
              <td>Origem:</td>
              <td><div id="filt_050101"><?php include($MODPAD.'lib/filt_050101.php'); ?></div></td>
            </tr>
            <tr>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td>Estado:</td>
              <td><?php
		$Qur = "SELECT sg_ID AS ID, sg_Descripcion AS NAME 
		  		FROM hd_statusfacturas";
		  mn_field('select','ED','status',$Status,$Qur,$DefSelect,'False','" style="width:370px'); ?></td>
            </tr>
          </table></td>
          <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td>Cliente</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','CliNombre','','','False',''); ?></td>
              <td>C&acirc;mbio</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','tax1','checked','','False',''); ?></td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td></td>
              <td>
                </td>
            </tr>
            <tr>
              <td>Dominio</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','ExcOrigen0','','','False',''); ?></td>
              <td>Estado</td>
              <td><?php 
			  if (isset($Colums[4])) { $Check = 'checked';} else { $Check = '';}
			  mn_field('checkbox','ED','VIEWColumns[]','status',$Check,'','False',''); ?></td>
            </tr>
            <tr>
              <td>Origen</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','ExcOrigen1','','','False',''); ?></td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td>Loja</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','ExcOrigen0','','','False',''); ?></td>
              <td>Observa&ccedil;&otilde;es</td>
              <td><?php mn_field('checkbox','ED','VIEWColumns[]','ExcNotes','checked','','False',''); ?></td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
          </table>
          </td>
          <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="1">
            <tr>
              <td>Ordenar por:</td>
              <td>
			  <?php 
			  $Qur = 'Operacao;Data;Recebido;Entregue;Status#exchange_operations`.`ref;exchange_operations`.`Time;Amount;acerto;status';
			  mn_field('hselect','ED','OrderBy1','',$Qur,'','False','');
			  $OrderOps = "ASC;DESC#ASC;DESC";
			  mn_field('hselect','ED','OrderAD1','ASC',$OrderOps,'1','False',''); ?>
              </td>
            </tr>
            <tr>
              <td>seguido de: </td>
              <td>
			  <?php 
			  $Qur = ';Operacao;Data;Recebido;Entregue;Status#;ref;Time;Amount;acerto;status';
			  mn_field('hselect','ED','OrderBy2','',$Qur,'','False','');
			  mn_field('hselect','ED','OrderAD2','ASC',$OrderOps,'1','False',''); ?></td>
            </tr>
            <tr>
              <td>seguido de: </td>
              <td>
			  <?php 
			  mn_field('hselect','ED','OrderBy3','',$Qur,'','False','');
			  mn_field('hselect','ED','OrderAD3','ASC',$OrderOps,'1','False',''); ?></td>
            </tr>
            <tr>
              <td rowspan="2">Op&ccedil;&otilde;es do Status: </td>
              <td><?php mn_field('checkbox','ED','BBar_Status','FraEnviado','','','','" disabled checked readonly="'); ?>
              Enviado</td>
            </tr>
            <tr>
              <td><?php mn_field('checkbox','ED','BBar_Status','FraCargo','','','',''); ?>
                Taxas</td>
            </tr>
          </table></td>
        </tr>
        <tr bgcolor="#F2F2F2">
          <td colspan="2" bgcolor="#F2F2F2"><table width="100%"  border="0" cellpadding="1" cellspacing="1">
            <tr>
              <td width="0">
	<?php 
	mn_field('button','ED','ExchQuery','Consultar','','','False','" onClick="
	replaceUrl(\'SUMS\',\'_response/call.php?get=Exchange/lib/vie_console.php\');
	replaceUrl(\'ConsoleRS\',\'_response/call.php?get=Exchange/lib/elem_order.php\');
	document.ExchQuery.action=\'_response/call.php?get=Exchange/lib/exchconsole.php\';
	subform(\'ExchQuery\',\'Console\');');
	mn_field('button','ED','DetailOrder','Ver Factura','','','False','" onClick="subform(\'ExchQuery\',\'Console\');'); ?>
	</td>
              <td width="100%"><div id="SUMS"><?php include($MODPAD.'lib/vie_console.php'); ?></div></td>
            </tr>
          </table>          </td>
        </tr>
</table>
</form>
<DIV id="ConsoleRS"></DIV>